//axios的配置
import Vue from 'vue'
import axios from "axios"
axios.defaults.baseURL="https://www.liulongbin.top:8888/api/private/v1/"
axios.defaults.timeout =3000;
//将token设置头请求头上
axios.interceptors.request.use(
    config=>{
      //摄制请求拦截器给我们请求头设置token
      var arr = JSON.parse(sessionStorage.getItem("loginmsg"));
      console.log(arr)
      var token;
      if(arr){
        token = arr.token
      }else{
        token = null
      }
      console.log(token)
      config.headers.Authorization=token;
      return config;
    }
  )
  //在response拦截器中，隐藏进度条
  axios.interceptors.response.use(config =>{
    return config
  })
  Vue.prototype.$http=axios;
